#include<iostream>
using namespace std;
#include "main_file/workerManager.h"
#include "main_file/worker.h"
#include "main_file/employee.h"
#include "main_file/manager.h"
#include "main_file/boss.h"

// 测试函数，并且运行能够产生多态
void test()
{
    Worker * worker = NULL;
    worker = new Employee(1, "张三", 1);
    worker->showInfo();
    delete worker;

    worker = new Manager(2, "李四", 2);
    worker->showInfo();
    delete worker;

    worker = new Boss(3, "王五", 3);
    worker->showInfo();
    delete worker;
}



int main() {

    WorkerManager wm;
    int choice = 0;
    test();						// 多态测试

    while (true)
    {
        //展示菜单
        wm.Show_Menu();
        cout << "请输入您的选择:" << endl;
        cin >> choice;

        switch (choice)
        {
            case 0: //退出系统
                wm.exitSystem();
                break;
            case 1: //添加职工
                wm.Add_Emp();
                break;
            case 2: //显示职工
                wm.Show_Emp();
                break;
            case 3: //删除职工
                wm.Del_Emp();
                break;
            case 4: //修改职工
                wm.Mod_Emp();
                break;
            case 5: //查找职工
                wm.Find_Emp();
                break;
            case 6: //排序职工
                wm.Sort_Emp();
                break;
            case 7: //清空文件
                wm.Clean_File();
                break;
            default:
                system("cls");		// 清屏操作
                break;
        }
    }

    system("pause");
    return 0;
}
